<?php
/* @var $this PointRecordController */
/* @var $model PointRecord */
/* @var $form CActiveForm */
?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'point-record-form',
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>
    
    <?php echo $form->labelEx($model,'resident.name'); ?>
    <?php if($model->isNewRecord){ ?>
		<?php $this->widget('CAutoComplete', array(
            'model'=>$model,
            'attribute'=>'matric_no',
            'minChars'=>2,
            'max'=>200,
            'url'=>CController::createUrl('autocomplete/byResidentName'),
            'htmlOptions'=>array('size'=>'50',))); 
        ?>
    <?php }else{ ?>
  		<?php echo $model->resident->name; ?>
        <?php echo $form->hiddenField($model,'matric_no'); ?>
    <?php } ?>


	<div class="row">
    <?php echo $form->labelEx($model,'cca_id'); ?>
    <?php if($model->isNewRecord){ ?>
		
		<?php $this->widget('CAutoComplete', array(
        'model'=>$model,
        'attribute'=>'cca_id',
        'minChars'=>2,
        'max'=>200,
        'url'=>CController::createUrl('autocomplete/byCcaName'),
        'htmlOptions'=>array('size'=>'50'))); 
		?>
	<?php }else{ ?>
    <?php echo $model->cca->name; ?>
    <?php echo $form->hiddenField($model,'cca_id'); ?>
    <?php } ?>
		<?php echo $form->error($model,'cca_id'); ?>
	</div>

	<div class="row">
    	<?php echo $form->labelEx($model,'points'); ?>
        <?php echo $form->textField($model,'points',array('size'=>10,'maxlength'=>10)); ?>
	</div>
        
        <div class="row">
    	<?php echo $form->labelEx($model,'description'); ?>
        <?php echo $form->textField($model,'description',array('size'=>50,'maxlength'=>140)); ?>
	</div>


	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->